package com.similarworld.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.similarworld.type.CommentStatus;

@Entity
@Table(name = "ITEM_COMMENTS")
public class ItemComment extends AbstractModel {

	private static final long serialVersionUID = 1L;

	@Column(length=2048)
	private String comment;

	@ManyToOne
	@JoinColumn(name = "ITEM_ID")
	private Item item;

	@ManyToOne
	@JoinColumn(name = "PARENT_ID")
	private ItemComment parent;

	/**
	 * Bu deger kullanici tarafindan set edilmeyecek.
	 * Kullanicinin set ettigi alan ItemCommentRate tablosunda
	 * tutulmaktadir. Bu alan ItemCommentRate uzerinde calisan 
	 * bir batch ile periyodik olarak guncellenecektir.
	 * */
	private Integer rate;

	@Enumerated(value = EnumType.STRING)
	private CommentStatus status;
	
	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public Item getItem() {
		return item;
	}

	public void setItem(Item item) {
		this.item = item;
	}

	public ItemComment getParent() {
		return parent;
	}

	public void setParent(ItemComment parent) {
		this.parent = parent;
	}

	public Integer getRate() {
		return rate;
	}

	public void setRate(Integer rate) {
		this.rate = rate;
	}

	public CommentStatus getStatus() {
		return status;
	}

	public void setStatus(CommentStatus status) {
		this.status = status;
	}

	public ItemComment() {
	}

}
